package com.atguigu.spzx.product.controller;

import com.atguigu.spzx.model.entity.product.Category;
import com.atguigu.spzx.model.vo.common.Result;
import com.atguigu.spzx.product.service.CategoryService;
import com.atguigu.spzx.product.service.ProductService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author LT
 * @create 2024-03-25-19:03
 */
@RestController
@RequestMapping("/api/product/category")
//@CrossOrigin
public class CategoryController {

    @Resource
    CategoryService categoryService;

    @GetMapping("/findCategoryTree")
    public Result findCategoryTree(){

        List<Category> categories = categoryService.findCategoryTree();
        return Result.ok(categories);
    }




}
